<template>
  <div class="pageContent">
    <!-- 顶部 -->
    <div class="top flexAround">
      <div class="top_content">
        <div class="top_content_title">在场人数</div>
        <div class="top_content_content">24</div>
      </div>
      <div class="top_content">
        <div class="top_content_title">离场人数</div>
        <div class="top_content_content">3</div>
      </div>
      <div class="top_content">
        <div class="top_content_title">总计人数</div>
        <div class="top_content_content">26</div>
      </div>
    </div>

    <!-- 中间内容 -->
    <div class="content">
      <div class="center flexBetweenCenter">
        <div class="center_title">人员列表</div>
        <div>
          <a-radio-group v-model="radioModel" @change="onChange">
            <a-radio-button value="all">全部</a-radio-button>
            <a-radio-button value="present">在场</a-radio-button>
            <a-radio-button value="exit">离场</a-radio-button>
          </a-radio-group>
          <a-input-search
            placeholder="请输入姓名查询"
            style="width: 200px;margin-left:20px"
            @search="onSearch"
          />
        </div>
      </div>
      <!-- 表格 -->
      <div class="atable">
        <a-table :columns="columns" :data-source="data">
          <span slot="action" slot-scope="text, record">
            <a style="color:#1890FF" @click="onEdit(text, record)">详情</a>
          </span>
        </a-table>
      </div>

      <!-- 分页 -->
      <div class="pagination flexBetween">
        <div>共{{total}} 条记录 第 {{current}} / {{Math.ceil((total/pageSize))}} 页</div>
        <div>
          <a-pagination
            :current="current"
            :page-size-options="pageSizeOptions"
            :total="total"
            show-size-changer
            :pinspector-size="pageSize"
            @showSizeChange="onShowSizeChange"
            @change="pageChange"
            show-quick-jumper
          >
            <template slot="buildOptionText" slot-scope="props">
              <span v-if="props.value !== '40'">{{ props.value }}条/页</span>
              <span v-if="props.value === '40'">全部</span>
            </template>
          </a-pagination>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
const columns = [
  { title: '人员编码', dataIndex: 'name', key: 'name' },
  { title: '姓名', dataIndex: 'proName', key: 'proName' },
  { title: '技术员', dataIndex: 'proCode', key: 'proCode', align: 'center' },
  { title: '部门', dataIndex: 'proId', key: 'proId', align: 'center' },
  { title: '进场时间', dataIndex: 'entryTime', key: 'entryTime', align: 'center' },
  { title: '离场时间', dataIndex: 'leavTime', key: 'leavTime', align: 'center' },
  {
    title: '操作',
    key: 'action',
    scopedSlots: { customRender: 'action' },
    align: 'center'
  }
]
const tabdata = [
  {
    key: '1',
    name: '010212131',
    proName: '张三',
    proCode: '技术员',
    proId: '工程部',
    entryTime: '2020-02-12',
    leavTime: '2020-02-12'
  },
  {
    key: '2',
    name: '010212131',
    proName: '张三',
    proCode: '技术员',
    proId: '工程部',
    entryTime: '2020-02-12',
    leavTime: '2020-02-12'
  },
  {
    key: '3',
    name: '010212131',
    proName: '张三',
    proCode: '技术员',
    proId: '工程部',
    entryTime: '2020-02-12',
    leavTime: '2020-02-12'
  },
  {
    key: '4',
    name: '010212131',
    proName: '张三',
    proCode: '技术员',
    proId: '工程部',
    entryTime: '2020-02-12',
    leavTime: '2020-02-12'
  },
  {
    key: '5',
    name: '010212131',
    proName: '张三',
    proCode: '技术员',
    proId: '工程部',
    entryTime: '2020-02-12',
    leavTime: '2020-02-12'
  }
]
export default {
  data() {
    return {
      radioModel: 'all',
      pageSizeOptions: ['5', '10', '20', '30', '40'],
      current: 1,
      pageSize: 10,
      total: 1,
      columns,
      data: tabdata
    }
  },
  methods: {
    onChange(e) {
      console.log(e.target.value)
    },
    onSearch(value) {
      console.log(value)
    },
    onEdit(text) {
      //   console.log(text)
      this.$router.push({ path: '/personnelInformation' })
    },
    onShowSizeChange(current, pageSize) {
      // console.log(current, pageSize)
      // this.current = 1
      // this.pageSize = pageSize
      // this.getTable()
    },
    pageChange(current, pageSize) {
      // this.current = current
      // this.pageSize = pageSize
      // this.getTable()
    }
  }
}
</script>

<style scoped>
.top {
  text-align: center;
  color: #555;
  margin-bottom: 20px;
  background: #fff;
  padding-top: 40px;
  padding-bottom: 40px;
}
.center {
  margin-bottom: 20px;
}
.content {
  background: #fff;
  /* padding: 15px 30px; */
  margin-bottom: 15px;
  width: 100%;
}
.top_content {
  flex: 1;
  border-right: 1px solid #ededed;
}
.top_content:last-of-type {
  border: none;
}
.top_content_content {
  color: #000;
  font-size: 30px;
  /* font-weight: 600; */
}
.center_title {
  font-size: 16px;
  color: #000;
  font-weight: 600;
  line-height: 100%;
}
.atable {
  margin-bottom: 20px;
}
</style>